﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RCSP.Biz
{
    /// <summary>
    /// Base repository interface
    /// </summary>
    /// <typeparam name="T">Type of entity</typeparam>
    public interface IRepository<T> where T : EntityBase, new()
    {
        /// <summary>
        /// Gets item by id
        /// </summary>
        /// <param name="id">Identifier</param>
        /// <returns>Entity</returns>
        T GetItem(int id);

        /// <summary>
        /// Gets all item by query
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        List<T> GetAllItemsByQuery(string query);

        /// <summary>
        /// Saves item
        /// </summary>
        /// <param name="entity">Entity</param>
        void SaveItem(T entity);

        /// <summary>
        /// Deletes item
        /// </summary>
        /// <param name="id">Item identifier</param>
        void DeleteItem(int id);

    }
}
